@(title: String, repository: Option[gitbucket.core.service.RepositoryService.RepositoryInfo] = None)(body: Html)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.plugin.PluginRegistry
@import gitbucket.core.view.helpers
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>@title</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="icon" href="@helpers.assets/common/images/gitbucket.png" type="image/vnd.microsoft.icon" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="@helpers.assets/vendors/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="@helpers.assets/vendors/octicons-4.2.0/octicons.css" rel="stylesheet">
    <link href="@helpers.assets/vendors/datepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link href="@helpers.assets/vendors/colorpicker/css/bootstrap-colorpicker.css" rel="stylesheet">
    <link href="@helpers.assets/vendors/google-code-prettify/prettify.css" type="text/css" rel="stylesheet"/>
    <link href="@helpers.assets/vendors/facebox/facebox.css" rel="stylesheet"/>
    <link href="@helpers.assets/vendors/AdminLTE-2.3.8/css/AdminLTE.min.css" rel="stylesheet">
    <link href="@helpers.assets/vendors/AdminLTE-2.3.8/css/skins/skin-blue.min.css" rel="stylesheet">
    <link href="@helpers.assets/vendors/font-awesome-4.6.3/css/font-awesome.min.css" rel="stylesheet">
    <link href="@helpers.assets/common/css/gitbucket.css" rel="stylesheet">
    <script src="@helpers.assets/vendors/jquery/jquery-1.12.2.min.js"></script>
    <script src="@helpers.assets/vendors/dropzone/dropzone.js"></script>
    <script src="@helpers.assets/common/js/validation.js"></script>
    <script src="@helpers.assets/common/js/gitbucket.js"></script>
    <script src="@helpers.assets/vendors/bootstrap-3.3.6/js/bootstrap.js"></script>
    <script src="@helpers.assets/vendors/bootstrap3-typeahead/bootstrap3-typeahead.js"></script>
    <script src="@helpers.assets/vendors/datepicker/js/moment.js"></script>
    <script src="@helpers.assets/vendors/datepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script src="@helpers.assets/vendors/colorpicker/js/bootstrap-colorpicker.js"></script>
    <script src="@helpers.assets/vendors/google-code-prettify/prettify.js"></script>
    <script src="@helpers.assets/vendors/elastic/jquery.elastic.source.js"></script>
    <script src="@helpers.assets/vendors/facebox/facebox.js"></script>
    <script src="@helpers.assets/vendors/jquery-hotkeys/jquery.hotkeys.js"></script>
    <script src="@helpers.assets/vendors/jquery-textcomplete-1.6.2/jquery.textcomplete.js"></script>
    @repository.map { repository =>
      <meta name="go-import" content="@context.baseUrl.replaceFirst("^https?://", "")/@repository.owner/@repository.name git @repository.httpUrl" />
    }
    <script src="@helpers.assets/vendors/AdminLTE-2.3.8/js/app.js" type="text/javascript"></script>
  </head>
  <body class="skin-blue page-load @if(context.sidebarCollapse){sidebar-collapse}">
    <div class="wrapper">
      <header class="main-header">
        <a href="@context.path/" class="logo">
          <img src="@helpers.assets/common/images/gitbucket.png" style="width: 24px; height: 24px; display: inline;"/>
          GitBucket
          <span class="header-version">@gitbucket.core.GitBucketCoreModule.getVersions.last.getVersion</span>
        </a>
        <nav class="navbar navbar-static-top" role="navigation">
          <!-- Sidebar toggle button-->
          @if(body.toString.contains("main-sidebar")){
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
              <span class="sr-only">Toggle navigation</span>
            </a>
          }
          <form id="search" action="@context.path/search" method="GET" class="pc navbar-form navbar-left" role="search">
            <div class="form-group">
              <input type="text" name="query" id="navbar-search-input" class="form-control" placeholder="Search repository"/>
            </div>
          </form>
          <ul class="pc nav navbar-nav">
            @if(context.loginAccount.isDefined){
              <li><a href="@context.path/dashboard/pulls">Pull requests</a></li>
              <li><a href="@context.path/dashboard/issues">Issues</a></li>
            }
            @gitbucket.core.plugin.PluginRegistry().getGlobalMenus.map { menu =>
              @menu(context).map { link =>
                <li><a href="@context.path/@link.path">@link.label</a></li>
              }
            }
          </ul>
          <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">
              @if(context.loginAccount.isDefined){
                <li class="dropdown">
                  <a class="dropdown-toggle menu" data-toggle="dropdown" href="#">
                    <i class="octicon octicon-plus" style="color: black;"></i><span class="caret" style="color: black; vertical-align: middle;"></span>
                  </a>
                  <ul class="dropdown-menu pull-right">
                    <li><a href="@context.path/new">New repository</a></li>
                    <li><a href="@context.path/groups/new">New group</a></li>
                  </ul>
                </li>
                <li class="dropdown">
                  <a class="dropdown-toggle menu" data-toggle="dropdown" href="#" data-toggle="tooltip" data-placement="bottom" title="Signed is as @context.loginAccount.get.userName">
                    @helpers.avatar(context.loginAccount.get.userName, 16)<span class="caret" style="color: black; vertical-align: middle;"></span>
                  </a>
                  <ul class="dropdown-menu pull-right">
                    <li><a href="@helpers.url(context.loginAccount.get.userName)">Your profile</a></li>
                    <li><a href="@helpers.url(context.loginAccount.get.userName)/_edit">Account settings</a></li>
                    @if(context.loginAccount.get.isAdmin){
                      <li><a href="@context.path/admin/users">System administration</a></li>
                    }
                    <li><a href="@context.path/signout">Sign out</a></li>
                  </ul>
                </li>
              } else {
                <li>
                  <a href="@context.path/signin?redirect=@helpers.urlEncode(context.currentPath)" class="pull-right" id="signin">Sign in</a>
                </li>
              }
            </ul>
          </div>
        </nav>
      </header>
      @body
    </div>
    <script>
      $(function(){
        $('#search').submit(function(){
          return $.trim($(this).find('input[name=query]').val()) != '';
        });
        $(".sidebar-toggle").on('click', function(e){
          $.get('@context.path/sidebar-collapse', { collapse: !$('body').hasClass('sidebar-collapse') });
        });
      });
    </script>
    @PluginRegistry().getJavaScript(context.request.getRequestURI).map { script =>
      <script>
        @Html(script)
      </script>
    }
  </body>
</html>
